import request from '@/utils/request'
import qs from 'qs'

export function create(data) {
    return request({
        url: '/createAffair',
        method: 'post',
        data
    })
}

export function remove(data) {
    return request({
        url: `/affair/${data.id}`,
        method: 'delete',
        params: data
    })
}

export function updateInfo(e) {
    let id = e.id
    console.log(e)
    let data = qs.stringify(e)
    return request({
        url: `/affair/${id}`,
        method: 'put',
        data
    })
}

export function readSingleInfo(data) {
    return request({
        url: `/affair/${data.id}`,
        method: 'get',
        params: data
    })
}

export function readInfo(data) {
    return request({
        url: 'affair',
        method: 'get',
        params: data
    })
}
export function getDataTotal() {
    return request({
        url: '/getAllTableNumbers',
        method: 'get',
        params: { table_name:  'know_bar'}
    })
}